<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Bags extends Model
{
    //转让或者交换的图书
    
    protected $table = 'yds_bags';

    protected $primaryKey = 'id';

    //关闭更新  'updated_at`, `created_at' 字段
    public $timestamps = false;

    //一对一关系(书包里的书籍对应的图书信息)
    public function hasOnebooks()
    {
        return $this->hasOne('App\Models\Book','book_id','book_id');
    }

    //一对一关系(同城换书的用户对应的用户信息)
    public function hasTcUsersReg()
    {
        return $this->hasOne('App\Models\UsersReg','uid','uid');
    }
}
